
{extend name="index/index" /}
{block name='main'}
<div class="container">
    <div class="row">
   
        
             <div class="col-md-3">
                {if empty($list['icon'])}
                <img src="__IMG__/1.jpg" style="height:200px;width:200px" >
                {else}
                <img src="__UPLOAD__{$list.icon}" style="height:200px;width:200px" >
                {/if}
             </div>

             <div class="col-md-6" id="geci" style="">
               <ul>
                 {if empty($list['name'])}
                 <li><h3>{$list['phone']}喜欢的音乐</h3></li>
          
                 <li><h3>{$list['phone']}</h3></li>
                 {else}
                 <li><h3>{$list['name']}喜欢的音乐</h3></li>
          
                 <li><h3>{$list['name']}</h3></li>
                 {/if}
                 <br>
                 <li>{$time} 更新</li>
                 <br>
                 <br>
               <button class="btn btn-danger" id='play'>播放</button>


               <button class="btn btn-primary">+</button>
               <button class="btn btn-primary">收藏</button>

               <button class="btn btn-primary">分享</button>
               <button class="btn btn-primary">下载</button>
               <button class="btn btn-primary">评价</button>
               <br>
               <br>
         

              </ul>

             </div>
             <div class="col-md-3"></div>
           </div>

      </div>



      <div class="container">
        <div class="row">
         <div class="col-md-2"></div>
         <div class="col-md-7 bg-primary ">
          <h5>我的收藏</h5>

         </div>
         <div class="col-md-3"></div>
         </div>

          <div class="col-md-2"></div>
          <div class="col-md-7">
          <table class="table table-hover bg-info">
            <tr>
              <th>歌曲标题</th>
              <th>歌手</th>
              <th>音乐图片</th>
              <th>专辑</th>
              <th>专辑图片</th>
              <th>操作</th>
    
            </tr>
            {foreach $result as $v}
            <tr>
               <td><a class="play" music="{$v['musicaddress']}" img='__UPLOAD__/music-img/{$v["gimg"]}' name='{$v["name"]}' style="cursor:pointer">{$v['name']}</a></td>
               <td>{$v['singer']}</td>
               <td><img src="__UPLOAD__/music-img/{$v.gimg}" style="height:50px;width:50px" ></td>
               <td>{$v['specials']}</td>
               <td><img src="__UPLOAD__/{$v.zimg}" style="height:50px;width:50px" ></td>
               <td><button data-id="{$v['id']}" class="btn btn-danger btn-xs del-btn">取消</button></td>
            </tr>
            {/foreach}
            
         
          </table>
         </div>
          <div class="col-md-3"></div>
  </div>



  <script>

     $(function(){
            //触发用户删除
            $('.del-btn').click(function(){
             var ac_id = $(this).attr('data-id');
            if (confirm('您确定要[取消]该收藏么?')) {

              var obj = $(this).parents('tr');
              delAjax(ac_id,obj);//执行删除操作
            }

            

            })



            

        });

        function delAjax(id,obj)
        {
          $.ajax({
            type:'delete',
            url:'/index/Soucang/delete/id/' + id,
            // dateType:'json',

            success:function(data){
              if (data.status) {
                 alert('取消成功!!!');
                 obj.remove();
              }else{
                 alert('取消失败!!!');
              }
            },

            error:function(){
              //Ajax执行失败
              alert('Ajax执行失败')
            }

          });
        }



    


  </script>
  
{/block}